//--------------------------------------------------------------
//
// Qizhi Zhang 
// ezhung@gmail.com
// http://www.moorwind.com
//
//--------------------------------------------------------------
package reader.controller
{
	import org.puremvc.as3.multicore.interfaces.ICommand;
	import org.puremvc.as3.multicore.interfaces.INotification;
	import org.puremvc.as3.multicore.patterns.command.SimpleCommand;
	
	import reader.core.ReaderModelLocator;
	import reader.core.WindowManager;
	import reader.view.components.TypedWindow;

	public class CloseCommand extends SimpleCommand implements ICommand
	{
		//////////////////////////////////////////////////////////////////////////////
		//methods
	
		override public function execute(notification:INotification):void
		{
			WindowManager.eachWindow(closeWindow);
			ReaderModelLocator.instance.airReader.nativeWindow.close();			
		}
		
		private function closeWindow(w:TypedWindow):void
		{
			w.close();
		}
	}
}